home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / TPTEST.DEM < prev    next >
Text File  |  1991-04-29  |  2KB  |  69 lines

  1. PROGRAM d13r6(input,output);
  2. (* driver for routine TPTEST *)
  3. (* compare two correlated distributions vs. two *)
  4. (* uncorrelated distributions *)
  5. CONST
  6.    npts=500;
  7.    eps=0.01;
  8.    nshft=10;
  9.    anoise=0.3;
  10. TYPE
  11.    glnparray = ARRAY [1..npts] OF real;
  12. VAR
  13.    gliset : integer;
  14.    glgset : real;
  15.    glinext,glinextp : integer;
  16.    glma : ARRAY [1..55] OF real;
  17.    ave1,ave2,ave3,gauss : real;
  18.    offset,prob1,prob2,shift,t1,t2: real;
  19.    var1,var2,var3 : real;
  20.    i,idum,j : integer;
  21.    data1,data2,data3 : glnparray;
  22.  
  23. (*$I MODFILE.PAS *)
  24. (*$I RAN3.PAS *)
  25.  
  26. (*$I GASDEV.PAS *)
  27.  
  28. (*$I GAMMLN.PAS *)
  29.  
  30. (*$I BETACF.PAS *)
  31.  
  32. (*$I BETAI.PAS *)
  33.  
  34. (*$I AVEVAR.PAS *)
  35.  
  36. (*$I TPTEST.PAS *)
  37.  
  38. BEGIN
  39.    gliset := 0;
  40.    idum := -5;
  41.    writeln('Correlated:':29,'Uncorrelated:':30);
  42.    writeln('Shift':7,'t':11,'Probability':17,'t':11,'Probability':17);
  43.    offset := (nshft DIV 2)*eps;
  44.    FOR j := 1 to npts DO BEGIN
  45.       gauss := gasdev(idum);
  46.       data1[j] := gauss;
  47.       data2[j] := gauss+anoise*gasdev(idum);
  48.       data3[j] := gasdev(idum)+anoise*gasdev(idum)
  49.    END;
  50.    avevar(data1,npts,ave1,var1);
  51.    avevar(data2,npts,ave2,var2);
  52.    avevar(data3,npts,ave3,var3);
  53.    FOR j := 1 to npts DO BEGIN
  54.       data1[j] := data1[j]-ave1+offset;
  55.       data2[j] := data2[j]-ave2;
  56.       data3[j] := data3[j]-ave3
  57.    END;
  58.    FOR i := 1 to nshft DO BEGIN
  59.       shift := i*eps;
  60.       FOR j := 1 to npts DO BEGIN
  61.          data2[j] := data2[j]+eps;
  62.          data3[j] := data3[j]+eps
  63.       END;
  64.       tptest(data1,data2,npts,t1,prob1);
  65.       tptest(data1,data3,npts,t2,prob2);
  66.       writeln(shift:6:2,t1:14:4,prob1:12:4,t2:16:4,prob2:12:4)
  67.    END
  68. END.
  69.